package com.linx.web.init;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linx.common.core.domain.model.RoleEnumBody;
import com.linx.common.core.enums.role.SystemRoleEnum;
import com.linx.common.core.service.RoleService;
import com.linx.common.core.utils.StringUtils;
import com.linx.park.domain.ParkInfo;
import com.linx.park.mapper.ParkInfoMapper;
import com.linx.system.domain.SysMenu;
import com.linx.system.domain.SysRole;
import com.linx.system.domain.SysRoleMenu;
import com.linx.system.domain.SysTenant;
import com.linx.system.mapper.SysMenuMapper;
import com.linx.system.mapper.SysRoleMapper;
import com.linx.system.mapper.SysRoleMenuMapper;
import com.linx.system.mapper.SysTenantMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * 初始化字典
 */
@Slf4j
@Component
public class InitRole implements ApplicationRunner {

    @Autowired
    private RoleService roleService;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void run(ApplicationArguments args) {
        roleService.initRole();

        log.info("----------- 初始化角色 -----------");
    }

}
